<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   template="../WEB-INF/shared/masterlayout.xhtml"
   xmlns:c="http://java.sun.com/jsp/jstl/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core">
  <ui:define name="leftCol">
    <ui:include src="components/leftCol.xhtml"/>
  </ui:define>
  <ui:define name="rightCol">
      <div class="reservation">
          <h1>Valj en paketlosning</h1>
          #{CompletePackageResBean.load()}
          <h:dataTable value="#{CompletePackageResBean.packageList}" var="package" styleClass="selectFlight">
              <h:column>
                <f:facet name="header">
                    <h:outputText value="Utresa"/>
                </f:facet>
                  <strong>Avgang</strong>
                  <p>
                    <h:outputText value="#{package.flight1.starttime}"/>, <h:outputText value="#{package.flight1.startdate}"/><br/>
                    <h:outputText value="#{package.flight1.flightPK.fromdestination}"/> (<h:outputText value="#{package.flight1.flightPK.fromairport}"/>)
                  </p>
                  <strong>Ankomst</strong>
                  <p>
                    <h:outputText value="#{package.flight1.endtime}"/>, <h:outputText value="#{package.flight1.enddate}"/><br/>
                    <h:outputText value="#{package.flight1.todestination}"/> (<h:outputText value="#{package.flight1.toairport}"/>)
                  </p>
              </h:column>
              <h:column>
                <f:facet name="header">
                    <h:outputText value="Hemresa"/>
                </f:facet>
                  <strong>Avgang</strong>
                  <p>
                    <h:outputText value="#{package.flight2.starttime}"/>, <h:outputText value="#{package.flight2.startdate}"/> <br/>
                    <h:outputText value="#{package.flight2.flightPK.fromdestination}"/> (<h:outputText value="#{package.flight2.flightPK.fromairport}"/>)
                  </p>
                  <strong>Ankomst</strong>
                  <p>
                    <h:outputText value="#{package.flight2.endtime}"/>, <h:outputText value="#{package.flight2.enddate}"/><br/>
                    <h:outputText value="#{package.flight2.todestination}"/> (<h:outputText value="#{package.flight2.toairport}"/>)
                  </p>
              </h:column>
              <h:column>
                <f:facet name="header">
                    <h:outputText value="Hotell"/>
                </f:facet>
                  <p><h:outputText value="#{package.hotelSuggestion.name}"/></p>
                  <h:graphicImage value="#{package.hotelSuggestion.pictureUrl}"/>
                  <p><h:outputText value="#{package.hotelSuggestion.description}"/></p>
              </h:column>
              <h:column>
                  <f:facet name="header">
                    <h:outputText value="Boka"/>
                  </f:facet>
                  <c:if test="#{LoginBean.loggedIn}">
                      <h:form>
                          <p>Not yet implemented</p>
                      </h:form>
                  </c:if>
                  <c:if test="#{!LoginBean.loggedIn}">
                      <p>Du maste vara inloggad for att boka.</p>
                  </c:if>
              </h:column>
          </h:dataTable>
      </div>
  </ui:define>
</ui:composition>